home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / moonstonemadness.swf / scripts / __Packages / mx / transitions / BroadcasterMX.as next >
Text File  |  2007-09-27  |  2KB  |  64 lines

  1. class mx.transitions.BroadcasterMX
  2. {
  3.    function BroadcasterMX()
  4.    {
  5.    }
  6.    static function initialize(o, dontCreateArray)
  7.    {
  8.       if(o.broadcastMessage != undefined)
  9.       {
  10.          delete o.broadcastMessage;
  11.       }
  12.       o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
  13.       o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
  14.       if(!dontCreateArray)
  15.       {
  16.          o._listeners = new Array();
  17.       }
  18.    }
  19.    function addListener(o)
  20.    {
  21.       this.removeListener(o);
  22.       if(this.broadcastMessage == undefined)
  23.       {
  24.          this.broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
  25.       }
  26.       return this._listeners.push(o);
  27.    }
  28.    function removeListener(o)
  29.    {
  30.       var _loc2_ = this._listeners;
  31.       var _loc3_ = _loc2_.length;
  32.       while(true)
  33.       {
  34.          _loc3_;
  35.          if(!_loc3_--)
  36.          {
  37.             break;
  38.          }
  39.          if(_loc2_[_loc3_] == o)
  40.          {
  41.             _loc2_.splice(_loc3_,1);
  42.             if(!_loc2_.length)
  43.             {
  44.                this.broadcastMessage = undefined;
  45.             }
  46.             return true;
  47.          }
  48.       }
  49.       return false;
  50.    }
  51.    function broadcastMessage()
  52.    {
  53.       var _loc5_ = String(arguments.shift());
  54.       var _loc4_ = this._listeners.concat();
  55.       var _loc6_ = _loc4_.length;
  56.       var _loc3_ = 0;
  57.       while(_loc3_ < _loc6_)
  58.       {
  59.          _loc4_[_loc3_][_loc5_].apply(_loc4_[_loc3_],arguments);
  60.          _loc3_ = _loc3_ + 1;
  61.       }
  62.    }
  63. }
  64.